<?php
class Tips
{
	public static function success($text,$title ='站点提示信息', $url = false, $dec = '2')
    {
        $content = '
            <!doctype html>
            <html>
            <head>
                <meta charset="utf-8">
                <title>'.$title.'</title>
                <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.4/css/bootstrap.min.css">
                <style>
                    @import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&display=swap");
    
                    body {
                        background-color: #f8f9fa;
                        font-family: "Noto Sans SC", sans-serif;
                    }
                    .container {
                        margin-top: 9%;
                    }
                    .panel-success {
                        border-color: #28a745;
                    }
                    .panel-heading {
                        background-color: #28a745;
                        color: white;
                        text-align: center;
                        padding: 20px;
                        border-radius: 5px 5px 0 0;
                        animation: fadeIn 1s ease-in-out;
                    }
                    .panel-body {
                        padding: 30px;
                        font-size: 18px;
                        text-align: center;
                        border-radius: 0 0 5px 5px;
                    }
                    h1 {
                        font-weight: 700;
                        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
                        margin: 0;
                    }
                    @keyframes fadeIn {
                        from { opacity: 0; }
                        to { opacity: 1; }
                    }
                </style>
            </head>
            <body>
                <div class="container">
                    <div class="panel panel-success">
                        <div class="panel-heading">
                            <h1>'.$title.'</h1>
                        </div>
                        <div class="panel-body">
                            <p>' . $text . '</p>
                        </div>
                    </div>
                </div>
            </body>
            </html>
        ';
    
        if ($url) {
            $content .= '<script>setTimeout(function (){location.href = "' . $url . '"},' . $dec . '000);</script>';
        }
    
        exit($content);
    }

	public static function error($text, $title = '站点提示信息',$url = false, $dec = '2')
    {
        $content = '
            <!doctype html>
            <html>
            <head>
                <meta charset="utf-8">
                <title>'.$title.'</title>
                <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.4/css/bootstrap.min.css">
                <style>
                    @import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&display=swap");
    
                    body {
                        background-color: #f8f9fa;
                        font-family: "Noto Sans SC", sans-serif;
                    }
                    .container {
                        margin-top: 9%;
                    }
                    .panel-danger {
                        border-color: #dc3545;
                    }
                    .panel-heading {
                        background-color: #dc3545;
                        color: white;
                        text-align: center;
                        padding: 20px;
                        border-radius: 5px 5px 0 0;
                        animation: fadeIn 1s ease-in-out;
                    }
                    .panel-body {
                        padding: 30px;
                        font-size: 18px;
                        text-align: center;
                        border-radius: 0 0 5px 5px;
                    }
                    h1 {
                        font-weight: 700;
                        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
                        margin: 0;
                    }
                    @keyframes fadeIn {
                        from { opacity: 0; }
                        to { opacity: 1; }
                    }
                </style>
            </head>
            <body>
                <div class="container">
                    <div class="panel panel-danger">
                        <div class="panel-heading">
                            <h1>'.$title.'</h1>
                        </div>
                        <div class="panel-body">
                            <p>' . $text . '</p>
                        </div>
                    </div>
                </div>
            </body>
            </html>
        ';
    
        if ($url) {
            $content .= '<script>setTimeout(function (){location.href = "' . $url . '"},' . $dec . '000);</script>';
        }
    
        exit($content);
    }
}
class http
{
	public static function ip()
	{
		if(getenv('HTTP_CLIENT_IP')){
            $ip = getenv('HTTP_CLIENT_IP');
         }
        elseif(getenv('HTTP_X_FORWARDED_FOR')){
          $ip = getenv('HTTP_X_FORWARDED_FOR');
        }
        elseif(getenv('REMOTE_ADDR')){
          $ip = getenv('REMOTE_ADDR');
        }
        else{
          $ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
        }
        return $ip;
	}
}